import { Injectable } from '@angular/core';
import { RequestClass } from './request.service';
@Injectable()
export class VolumeService {
    constructor(private requestclass: RequestClass) {}
    fetchApplicantStatisticsByTime = async ({ type, currentTime }) => {
        return await this.requestclass.request.Pget(
            '/statistical/getapplicantstatistical',
            {
                params: {
                    currentTime,
                    type,
                },
            }
        );
    };

    // 工业园区用水统计
    // http://115.157.195.222:3000/project/16/interface/api/58
    fetchAreaVolumeByTime = async ({ type, currentTime }) => {
        return await this.requestclass.request.get(
            '/areareport/getareareport',
            {
                params: {
                    currentTime,
                    type,
                },
            }
        );
    };

    // 区域用水统计
    // http://115.157.195.222:3000/project/16/interface/api/58
    fetchDistrictVolumeByTime = async ({ type, currentTime }) => {
        return await this.requestclass.request.get(
            '/districtreport/getdistrictreport',
            {
                params: {
                    currentTime,
                    type,
                },
            }
        );
    };

    // 乡镇用水统计
    // http://115.157.195.222:3000/project/16/interface/api/55
    // http://115.157.195.222:3000/project/16/interface/api/57
    fetchTownVolumeByTime = async ({ type, currentTime }) => {
        return await this.requestclass.request.get(
            '/townreport/gettownreport',
            {
                params: {
                    currentTime,
                    type,
                },
            }
        );
    };

    // 村庄用水统计
    // http://115.157.195.222:3000/project/16/interface/api/58
    fetchVillageVolumeByTime = async ({ type, currentTime }) => {
        return await this.requestclass.request.get(
            '/villagereport/getvillagereport',
            {
                params: {
                    currentTime,
                    type,
                },
            }
        );
    };

    // 机井用水统计
    // http://115.157.195.222:3000/project/16/interface/api/59
    fetchWellVolumeByTime = async ({ type, time, well_name }) => {
        return await this.requestclass.request.get(
            '/wellvolume/findbyconditions',
            {
                params: {
                    type,
                    time,
                    well_name,
                },
            }
        );
    };

    // 特定机井用水统计
    // http://115.157.195.222:3000/project/16/interface/api/59
    fetchSpecificWellVolumeByTime = async ({ type, time, id }) => {
        return await this.requestclass.request.get(
            '/wellinfo/findvolumebyday',
            {
                params: {
                    type,
                    time,
                    well_id: id,
                },
            }
        );
    };

    // 机井用水统计
    // http://115.157.195.222:3000/project/16/interface/api/59
    fetchWellDataByConfig = async ({ id, start, end }) => {
        return await this.requestclass.request.get(
            '/wellinfo/findvolumebytime',
            {
                params: {
                    well_id: id,
                    startTime: start,
                    endTime: end,
                },
            }
        );
    };
}
